﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

#pragma warning disable CS8618
namespace OpenAiProxy.API.Models
{
    /// <summary>
    /// 账户请求历史表
    /// </summary>
    [Table("account_history")]
    public class AccountHistory
    {
        [Key]
        [Column("id", TypeName = "varchar(32)")]
        public string Id { get; set; }

        /// <summary>
        /// 账户id
        /// </summary>
        [Required]
        [Column("account_id", TypeName = "varchar(32)")]
        public string AccountId { get; set; }

        /// <summary>
        /// 问题内容
        /// </summary>
        [Required]
        [Column("question", TypeName = "varchar(256)")]
        public string Question { get; set; }

        /// <summary>
        /// ApiUrl
        /// </summary>
        [Column("api_url", TypeName = "varchar(100)")]
        public string ApiUrl { get; set; }

        /// <summary>
        /// ApiKey
        /// </summary>
        [Column("api_key", TypeName = "varchar(100)")]
        public string ApiKey { get; set; }

        /// <summary>
        /// 答案内容
        /// </summary>
        [Column("answer", TypeName = "text")]
        public string Answer { get; set; }

        /// <summary>
        /// 错误信息
        /// </summary>
        [Column("error_message", TypeName = "text")]
        public string ErrorMessage { get; set; }

        /// <summary>
        /// 是否请求成功(0-否，1-是)
        /// </summary>
        [Required]
        [Column("is_success", TypeName = "tinyint unsigned")]
        public byte IsSuccess { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Required]
        [Column("create_time", TypeName = "datetime")]
        public DateTime? CreateTime { get; set; }
    }
}
